package com.asman.vr.dto

import androidx.annotation.MainThread
import com.asman.vr.network.Api
import com.asman.vr.network.RequestBody
import com.asman.vr.network.liveData
import java.util.concurrent.Executor

class PayRepository(private val api: Api, private val networkExecutor: Executor) {

    @MainThread
    fun createCharge(channel: String, payment: Long, paymentId: Long) =
        liveData(api.createCharge(RequestBody.CreateCharge(channel, 10050, payment, paymentId)))

    @MainThread
    fun getPayInfo(paymentId: Long) = liveData(api.getPayInfo(paymentId))

    @MainThread
    fun getPayResult(paymentId: Long) = liveData(api.getPayResult(paymentId))

    @MainThread
    fun submitPayBank(tradeId: Long, paymentId: Long, paymentStage: Int, imgUrls: List<String>) =
        liveData(
            api.submitPayBank(RequestBody.UploadBackPay(tradeId, paymentId, paymentStage, imgUrls))
        )

    @MainThread
    fun getPayHistoryList(tradeId: Long, paymentStage: Int) =
        liveData(api.getPayHistory(tradeId, paymentStage))

    @MainThread
    fun getAllPayHistory(projectId: Long) = liveData(api.getAllPayHistory(projectId))

}